#!/usr/bin/perl

require './ietman-lib.pl';

my ($telnet_stat);

&header($text{'iscsi_title'}, "", undef, 0, 1);

$iet_stat = &get_iet_status();
$iet_str = &get_gstr();
if($iet_stat eq "started"){
	$iet_stat = $text{'iscsi_start'};
}elsif($iet_stat eq "stopped"){
	$iet_stat = $text{'iscsi_stop'};
}elsif($iet_stat eq "warning"){
	$iet_stat = $text{'warning'};
}

print "<form name=tnform action=ietact.cgi method=post>\n";

print "<table class=mode1>\n";
print "<tr><td>$text{'iscsi_id'}</td><td><input name=tgtstr class=text value=$iet_str></td>\n";
print "<td><input name=changestr type=submit class=button1 value=$text{'submit_change'} onclick='return change_str();'></td></tr>\n";
print "<tr><td>$text{'iscsi_status'}\t</td><td><b>$iet_stat</b></td>";
print "<td><input name=submit_start type=submit class=button1 value=$text{'submit_start'} onclick='start_iet()'></td>\n";
print "<td><input name=submit_stop type=submit class=button1 value=$text{'submit_stop'} onclick='stop_iet()'></td>\n";
print "</tr>";
print "</table>";
print "<p><input name=oper type=hidden value=\'\'>";

print "</form>\n";

print <<EOF;
<script>
function start_iet()
{

	document.forms[0].oper.value = "start";
}

function stop_iet()
{
	document.forms[0].oper.value = "stop";
}
function change_str()
{
	document.forms[0].oper.value = "change";
	document.forms[0].action = "chgstr.cgi";
}
</script>
EOF

&footer("/", $text{'index'});
